package com.springboot.demo.thread_pool;

import com.springboot.demo.copy.Person;
import java.util.concurrent.Callable;

/**
 * 自定义带返回值的任务
 *
 * @author supu
 * @date 2019-03-29 13:49
 **/
public class CustomFuture implements Callable {
    private Person person;

    public CustomFuture(Person person) {
        this.person = person;
    }

    @Override
    public Object call() throws Exception {
        System.out.println(Thread.currentThread().getName()+"is run");
        person.setAge(person.getAge() + 1);
        Thread.sleep(5000);
        return person;
    }
}
